Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: migrate package manager from Poetry to Rye #6

Merged
merged 4 commits into from
Jul 26, 2024
Merged

chore: migrate package manager from Poetry to Rye #6

merged 4 commits into from
Jul 26, 2024

Conversation

iktakahiro
Copy link
Owner

@iktakahiro iktakahiro commented Jul 26, 2024

Summary by CodeRabbit

  • New Features

    • Transitioned from Poetry to Hatch for dependency management, improving project structure and flexibility.
    • Updated project version from 0.9.0 to 0.10.0, indicating new enhancements.
    • Enhanced development environment with a new Python interpreter setting.
  • Bug Fixes

    • Improved compatibility with Python dependencies by updating version requirements to support Python 3.12 and above.

Copy link

coderabbitai bot commented Jul 26, 2024

Walkthrough

This update transitions the project’s dependency management from Poetry to Rye, modernizing the environment setup. The .devcontainer/Dockerfile now installs Rye instead of Poetry, improving Python environment handling. The Python interpreter settings in .vscode/settings.json have been adjusted for better compatibility, and pyproject.toml has been restructured to support Hatch while updating Python version requirements and dependencies. These changes enhance project maintainability and align with more recent Python practices.

Changes

File Change Summary
.devcontainer/Dockerfile Replaced Poetry installation with Rye, including setting up environment variables for Rye configuration.
.vscode/settings.json Changed from no specific formatting provider to setting the default Python interpreter to the virtual environment.
pyproject.toml Transitioned from Poetry to Hatch, updated project version, Python requirements, and restructured dependencies.

Sequence Diagram(s)

sequenceDiagram
    participant Developer
    participant VSCode
    participant Docker
    participant Rye
    participant Hatch

    Developer->>VSCode: Open project
    VSCode->>Docker: Build container
    Docker->>Rye: Install dependencies
    Rye->>Hatch: Build project
    Hatch-->>Docker: Project ready
    Docker-->>VSCode: Container built
    VSCode-->>Developer: Environment ready
Loading

🐰 In fields so wide and bright,
A change has brought new delight!
From Poetry’s strum to Rye’s sweet tune,
Our project hops towards the moon!
With Hatch at the helm, we leap and bound,
In this fresh garden, joy is found! 🌼✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 36a5a0a and 7dcf5ec.

Files ignored due to path filters (3)
  • poetry.lock is excluded by !**/*.lock
  • requirements-dev.lock is excluded by !**/*.lock
  • requirements.lock is excluded by !**/*.lock
Files selected for processing (3)
  • .devcontainer/Dockerfile (1 hunks)
  • .vscode/settings.json (1 hunks)
  • pyproject.toml (1 hunks)
Files skipped from review due to trivial changes (1)
  • .vscode/settings.json
Additional comments not posted (12)
.devcontainer/Dockerfile (4)

4-4: Good practice: Use of pipefail option.

Setting the pipefail option ensures that the shell will exit if any command in a pipeline fails, which is a good practice for robust error handling.


5-5: Approved: Installation of Rye using curl.

The command uses curl to download and install Rye with specific options for error handling and non-interactive installation.


7-7: Approved: Setting RYE_HOME environment variable.

The command sets the RYE_HOME environment variable to a specific directory, which is necessary for configuring Rye.


8-8: Approved: Updating PATH to include Rye shims.

The command updates the PATH environment variable to include Rye shims, which is necessary for using Rye commands.

pyproject.toml (8)

1-1: Approved: Transition from Poetry to Hatch.

The [tool.poetry] section is renamed to [project], indicating a shift from Poetry to Hatch for project management.


3-3: Approved: Project version update.

The project version is updated from 0.9.0 to 0.10.0, suggesting new features or improvements.


5-5: Approved: Project metadata.

The project description and author details are necessary for project metadata.


6-12: Approved: Listing dependencies.

Dependencies are listed under the new [project] section with specific versions, which is necessary for the project.


14-14: Approved: Python version requirement update.

The Python version requirement is updated from ^3.11 to >=3.12, indicating a move to support newer Python features.


16-18: Approved: Build system configuration.

The [build-system] section specifies hatchling as the build backend, replacing the previous Poetry configuration.


20-28: Approved: Development dependencies management.

The [tool.rye] section is introduced with development dependencies, indicating a management strategy using Rye.


30-34: Approved: Additional Hatch configuration.

The [tool.hatch.metadata] and [tool.hatch.build.targets.wheel] sections provide additional configuration for Hatch.

@iktakahiro iktakahiro force-pushed the rye branch 2 times, most recently from dd714e5 to 861d7e4 Compare July 26, 2024 06:41
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 7dcf5ec and 5f67184.

Files ignored due to path filters (2)
  • requirements-dev.lock is excluded by !**/*.lock
  • requirements.lock is excluded by !**/*.lock
Files selected for processing (10)
  • .github/workflows/test.yml (1 hunks)
  • Makefile (1 hunks)
  • dddpy/domain/book/book_exception.py (3 hunks)
  • dddpy/domain/book/book_repository.py (1 hunks)
  • dddpy/infrastructure/sqlite/book/book_dto.py (1 hunks)
  • dddpy/presentation/schema/book/book_error_message.py (1 hunks)
  • dddpy/usecase/book/book_command_model.py (1 hunks)
  • dddpy/usecase/book/book_command_usecase.py (2 hunks)
  • dddpy/usecase/book/book_query_model.py (1 hunks)
  • pyproject.toml (1 hunks)
Files skipped from review due to trivial changes (4)
  • dddpy/domain/book/book_repository.py
  • dddpy/infrastructure/sqlite/book/book_dto.py
  • dddpy/usecase/book/book_command_usecase.py
  • dddpy/usecase/book/book_query_model.py
Additional comments not posted (25)
dddpy/presentation/schema/book/book_error_message.py (3)

11-11: Change from example to examples is appropriate.

The Field declaration now uses the examples parameter, which allows for multiple examples. This change is correct and improves flexibility.


15-15: Change from example to examples is appropriate.

The Field declaration now uses the examples parameter, which allows for multiple examples. This change is correct and improves flexibility.


19-19: Change from example to examples is appropriate.

The Field declaration now uses the examples parameter, which allows for multiple examples. This change is correct and improves flexibility.

Makefile (8)

1-1: Variable definition updated to use Rye.

The RYE variable is defined to replace the POETRY variable. This change is correct and aligns with the migration to Rye.


2-2: Command updated to use Rye for running tests.

The PYTEST command is updated to use rye. This change is correct and aligns with the migration to Rye.


3-3: Command updated to use Rye for type checking.

The MYPY command is updated to use rye. This change is correct and aligns with the migration to Rye.


4-4: Command updated to use Rye for code formatting.

The BLACK command is updated to use rye. This change is correct and aligns with the migration to Rye.


5-5: Command updated to use Rye for import sorting.

The ISORT command is updated to use rye. This change is correct and aligns with the migration to Rye.


6-6: Command updated to use Rye for linting.

The PYLINT command is updated to use rye. This change is correct and aligns with the migration to Rye.


7-7: Command updated to use Rye for running the application.

The UVICORN command is updated to use rye. This change is correct and aligns with the migration to Rye.


11-15: Targets updated to use Rye for installation and updates.

The install and update targets are updated to use rye. These changes are correct and align with the migration to Rye.

.github/workflows/test.yml (5)

11-11: Python version matrix expanded to include Python 3.12.

The Python version matrix now includes Python 3.11 and 3.12. This change is correct and enhances the flexibility of the testing setup.


13-13: Checkout action version updated to v4.

The checkout action version is updated to v4. This change is correct and aligns with the latest version of the action.


17-17: Setup-Python action version updated to v5.

The setup-python action version is updated to v5. This change is correct and aligns with the latest version of the action.


20-25: Updated installation steps to use Rye.

The installation steps are updated to install Rye instead of Poetry. These changes are correct and align with the migration to Rye.


28-28: Command updated to use Rye for running tests.

The Pytest command is updated to use Rye. This change is correct and aligns with the migration to Rye.

dddpy/domain/book/book_exception.py (3)

4-10: LGTM!

The BookNotFoundError class is well-defined with a clear error message.


Line range hint 12-18:
LGTM!

The BooksNotFoundError class is well-defined with a clear error message.


Line range hint 20-26:
LGTM!

The BookIsbnAlreadyExistsError class is well-defined with a clear error message.

pyproject.toml (4)

1-14: LGTM!

The [project] section is well-defined with updated project metadata and dependencies.


16-18: LGTM!

The [build-system] section is well-defined with the updated build backend.


20-28: LGTM!

The [tool.rye] section is well-defined with updated development dependencies.


30-34: LGTM!

The [tool.hatch.metadata] and [tool.hatch.build.targets.wheel] sections are well-defined.

dddpy/usecase/book/book_command_model.py (2)

7-11: LGTM!

The BookCreateModel class is well-defined with the updated examples parameter.


18-21: LGTM!

The BookUpdateModel class is well-defined with the updated examples parameter.

@iktakahiro iktakahiro merged commit be3dc68 into main Jul 26, 2024
4 checks passed
@iktakahiro iktakahiro deleted the rye branch July 27, 2024 04:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant